package com.atgao.commu;

import com.atgao.commu.mapper.mapper.UserMapper;
import com.atgao.commu.mapper.pojo.User;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties;
import org.springframework.cache.interceptor.CacheAspectSupport;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@MapperScan("com.atgao.commu.mapper.mapper")
public class DemoApplication {
//	@Autowired
//	private UserMapper userMapper;
//为什么没有
	public static void main(String[] args) {
//		SpringApplication.run(DemoApplication.class, args);

		ConfigurableApplicationContext run = SpringApplication.run(DemoApplication.class, args);

//		//2、查看容器里面的组件
//		String[] names = run.getBeanDefinitionNames();
//		for (String name : names) {
//			System.out.println(name);
//		}
//		int beanDefinitionCount = run.getBeanDefinitionCount();
//		System.out.println(beanDefinitionCount);
//
//		String[] beanNamesForType = run.getBeanNamesForType(CacheAspectSupport.class);
//		System.out.println("======"+beanNamesForType.length);
//
//		//3、从容器中获取组件
//
//		String[] beanNamesForType1 = run.getBeanNamesForType(WebMvcProperties.class);
//		System.out.println("======"+beanNamesForType1.length);
//
//		boolean tom = run.containsBean("userMapper");
//		System.out.println("容器中Tom组件："+tom);


//			User user = userMapper.selectById(101);
//			System.out.println(user);
////        user = userMapper.selectByName("liubei");
////        System.out.println(user);

//        user = userMapper.selectByEmail("nowcoder101@sina.com");
//        System.out.println(user);

	}

}
